<?php
/**
 * Pert Library
 * Test
 * SQLGenerator Classes
 *
 * @author	Emre Hasegeli <hasegeli@gmail.com>
 * @license	GNU General Public License v3
 */

namespace Pert\SQLGenerator;

require '../SQLGenerator.php';

$drug = new Table('Drug',
		'Medicine',
		array(1 => 'Name'));

$drug->AddCondition(new ArrayCondition('Language',
		new ArrayInput(array(2))));

$drugForm = $drug->AddChild(new Table('Drug_DrugForm',
		'Medicine',
		array(1 => 'Name')));

$product = $drugForm->AddChild(new Table('DrugForm_Product',
		'Medicine',
		array(1 => 'Name',
				2 => 'Unpublished')));

$product->AddCondition(new Condition('id',
		new Input(3)));

$substance = new LingualNamedTable('Substance',
		'Medicine',
		array(1 => 'Name'),
		array(1,
				2),
		true);

$ingredient = $drugForm->AddChild(new IndicativeTable('DrugForm_Ingredient',
		'Medicine',
		array(1 => 'Substance'),
		$substance));

echo '<p >' . $ingredient->SelectSQL() . '</p>';
